package seata.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import seata.dao.SeataTable1Mapper;
import seata.feign.SeataTable3Client;
import seata.feign.SeataTable2Client;
import seata.service.SeataTable1Service;

@RestController
public class Provider8804Controller {
    @Autowired
    private SeataTable1Service seataTable1Service;
    @Autowired
    private SeataTable2Client seataTable2Client;
    @Autowired
    private SeataTable3Client seataTable3Client;
    @Autowired
    private SeataTable1Mapper seataTable1Mapper;

    @GetMapping("/c1")
    public String c1(){
        return seataTable1Mapper.getSeataTableById(1).toString();
    }

    @GetMapping("/update2")
    public String update2(){
        seataTable2Client.update("2");
        return "success";
    }

    @GetMapping("/update3")
    public String update3(){
        seataTable3Client.update("3");
        return "success";
    }

    @GetMapping("/update/{name1}/{name2}/{name3}")
    public String update(@PathVariable String name1, @PathVariable String name2, @PathVariable String name3){
        seataTable1Service.updateSeataTableOneToThree(name1, name2, name3);
        return "success";
    }
}
